package com.example.syssoft.controller;


import com.example.syssoft.common.controller.LogicController;
import com.example.syssoft.config.Result;
import com.example.syssoft.dao.BusinessDao;
import com.example.syssoft.domain.Business;
import com.example.syssoft.domain.param.AddShopParam;
import com.example.syssoft.service.BusinessService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Tag(name = "商家控制器")
@RequestMapping("/business")
public class BusinessController extends LogicController<BusinessService, BusinessDao, Business,Long> {

    public BusinessController(BusinessService ls) {
        super(ls);
    }

    @PostMapping("/addShop")
    @Operation(summary = "新增商店")
    public Result addShop(@RequestBody AddShopParam param){
        return getService().addShop(param.getBusinessId(),param.getShop());
    }

    @GetMapping("/getAllBusiness")
    @Operation(summary = "获得所有商家（分页）")
    public Result getAllBuisness(int size ,int page){
        return getService().getAllBusiness(size,page);
    }

}
